<div>
    <ol class="breadcrumb" >
        <li> <i class="fa fa-anchor"></i>
            &nbsp;厂商运营商
        </li>
        <li>账户列表</li>
        <li style="float: right;" >
            <a href="__URL__/role" ><b>角色权限管理</b></a>
        </li>
        <li style="float: right;" >
            <a href={:U("Fac/addFac")} >添加厂商账号</a>
        </li>
        <li style="float: right;" >
            <a href={:U("Fac/addFac",array('oper'=>1))} >添加运营商账号</a>
        </li>
    </ol>
    <ul class="nav nav-tabs" role="tablist">

        <if condition="$_GET['tab'] eq 1">
            <li role="presentation" >
                <a href="#home" onclick="window.location.href='__URL__/index'" aria-controls="home" role="tab" data-toggle="tab">厂商</a>
            </li>

            <li role="presentation" class="active">
                <a href="#profile" aria-controls="profile" role="tab" data-toggle="tab">运营商</a>
            </li>
            <else />
            <li role="presentation" class="active">
                <a href="#home" aria-controls="home" role="tab" data-toggle="tab">厂商</a>
            </li>

            <li role="presentation">
                <a href="#profile" onclick="window.location.href='__URL__/index/tab/1'" aria-controls="profile" role="tab" data-toggle="tab">运营商</a>
            </li>
        </if>

    </ul>
    <div class="tab-content">
        <if condition="$_GET['tab'] eq 1">
            <div role="tabpanel" class="tab-pane" id="home">
        <else />
            <div role="tabpanel" class="tab-pane active" id="home">
        </if>
        <div class="panel">
            <div class="panel-heading" >
                <i class="fa fa-list"></i>
                &nbsp;&nbsp;厂商列表
            </div>
            <form class="search-form" action={:U("Fac/index")} method="get">
                <div class="panel-body search-panel-body retract">
                    <div class="col-xs-3 search-col" >
                        <div class="input-group" >
                            <span class="input-group-addon">厂商编号</span>
                            <input type="text" name="fac_login_name" class="form-control" value="" placeholder="厂商编号"></div>
                    </div>
                    <div class="col-xs-2 search-col">
                        <button  type="submit" class="btn btn-warning">
                            <i class="fa fa-search"></i>
                            &nbsp;搜索
                        </button>
                    </div>
                </div>
            </form>
            <table class="table table-bordered table-striped table-mcit">
                <thead>
                <tr>
                    <th >
                        <button class='btn btn-block btn-mcit' type='button' >ID</button>
                    </th>
                    <th >
                        <button class='btn btn-block btn-mcit' type='button' >厂商编号</button>
                    </th>
                    <th >
                        <button class='btn btn-block btn-mcit' type='button' >品牌</button>
                    </th>
                    <th >
                        <button class='btn btn-block btn-mcit' type='button' >厂商名称</button>
                    </th>
                    <th >
                            <button class='btn btn-block btn-mcit' type='button' >硬件密码</button>
                    </th>
                    <th>
                        <button class='btn btn-block btn-mcit' type='button'>操作</button>
                    </th>
                </tr>
                </thead>
                <tbody id="DataTableContent">
                <empty name="fac">
                    <td colspan="99" style="text-align:center" class="danger"> <strong><i class="fa fa-meh-o"></i>
                        &nbsp;&nbsp;当前条件下没有数据</strong>
                    </td>
                    <else />
                    <volist name="fac" id="data">
                        <td>
                            <p class="mcit-table-p">{$data.id}</p>
                        </td>
                        <td>
                            <p class="mcit-table-p">{$data.fac_login_name}</p>
                        </td>
                        <td>
                            <p class="mcit-table-p">{$data.name}</p>
                        </td>
                        <td>
                            <p class="mcit-table-p">{$data.fac_name}</p>
                        </td>
                        <td>
                            <p class="mcit-table-p">{$data.key}</p>
                        </td>
                        <td>
                            <a class="btn btn-sm btn-warning" href="__URL__/detail/id/{$data.id}">
                                <i class="fa fa-eye"></i>
                                &nbsp;查看
                            </a>
                            <if condition="$data.pid eq 0">
                                <a class="btn btn-sm btn-primary" href="__URL__/index/parent/{$data.id}">
                                    <i class="fa fa-users"></i>
                                    &nbsp;子管理员
                                </a>

                                <a class="btn btn-sm btn-primary" href="__URL__/manageFac/id/{$data.id}">
                                    <i class="fa fa-edit"></i>
                                    &nbsp;类型管理
                                </a>
                            </if>
                            <a class="btn btn-sm btn-warning" href="__URL__/editFac/id/{$data.id}">
                                <i class="fa fa-edit"></i>
                                &nbsp;修改
                            </a>
                            <if condition="$_SESSION['role'] eq 805 or $_SESSION['role'] eq 802">
                                <a class="btn btn-sm btn-danger delFac" data-id="{$data.id}" data-nid="2">
                                    <i class="fa fa-trash-o"></i>
                                    &nbsp;删除
                                </a>
                                <else /></if>
                        </td>
                        </tr>
                    </volist>
                </empty>
                <tr>
                    <td colspan="99" style="text-align:center">
                        <ul class="pagination">{$pageView}</ul>
                    </td>
                </tr>
                </tbody>
            </table>
        </div>
    </div>
    <if condition="$_GET['tab'] eq 1">
        <div role="tabpanel" class="tab-pane active" id="profile">
    <else />
        <div role="tabpanel" class="tab-pane" id="profile">
    </if>
    <div class="panel">
        <div class="panel-heading" >
            <i class="fa fa-list"></i>
            &nbsp;&nbsp;运营商列表
        </div>
        <form class="search-form" action={:U("Fac/index")} method="get">
            <div class="panel-body search-panel-body retract">
                <div class="col-xs-3 search-col" >
                    <div class="input-group" >
                        <span class="input-group-addon">运营商名称</span>
                        <input type="text" name="fac_name" class="form-control" value="" placeholder="运营商名称">
                        <input type="hidden" name="tab" value="1"/>
                    </div>
                </div>
                <div class="col-xs-2 search-col">
                    <button  type="submit" class="btn btn-warning">
                        <i class="fa fa-search"></i>
                        &nbsp;搜索
                    </button>
                </div>
            </div>
        </form>
        <table class="table table-bordered table-striped table-mcit">
            <thead>
            <tr>
                <th >
                    <button class='btn btn-block btn-mcit' type='button' >ID</button>
                </th>
                <th >
                    <button class='btn btn-block btn-mcit' type='button' >运营商账号</button>
                </th>
                <th >
                    <button class='btn btn-block btn-mcit' type='button' >运营商名称</button>
                </th>
                <th >
                    <button class='btn btn-block btn-mcit' type='button'>操作</button>
                </th>
            </tr>
            </thead>
            <tbody id="DataTableContents">
            <empty name="fac">
                <td colspan="99" style="text-align:center" class="danger"> <strong><i class="fa fa-meh-o"></i>
                    &nbsp;&nbsp;当前条件下没有数据</strong>
                </td>
                <else />
                <volist name="fac" id="data">
                    <td>
                        <p class="mcit-table-p">{$data.id}</p>
                    </td>
                    <td>
                        <p class="mcit-table-p">{$data.fac_login_name}</p>
                    </td>
                    <td>
                        <p class="mcit-table-p">{$data.fac_name}</p>
                    </td>
                    <td>
                        <a class="btn btn-sm btn-warning" href="__URL__/detail/tab/1/id/{$data.id}">
                            <i class="fa fa-eye"></i>
                            &nbsp;查看
                        </a>
                        <if condition="$data.pid eq 0">
                            <a class="btn btn-sm btn-primary" href="__URL__/index/parent/{$data.id}">
                                <i class="fa fa-users"></i>
                                &nbsp;子管理员
                            </a>
                        </if>
                        <a class="btn btn-sm btn-warning" href="__URL__/editFac/tab/1/id/{$data.id}">
                            <i class="fa fa-edit"></i>
                            &nbsp;修改
                        </a>
                        <if condition="$_SESSION['role'] eq 805 or $_SESSION['role'] eq 802">
                            <a class="btn btn-sm btn-danger delFacs" data-id="{$data.id}" data-nid="3">
                                <i class="fa fa-trash-o"></i>
                                &nbsp;删除
                            </a>
                            <else /></if>
                    </td>
                    </tr>
                </volist>
            </empty>
            <tr>
                <td colspan="99" style="text-align:center">
                    <ul class="pagination">{$pageView}</ul>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
</div>
</div>
<import file="js.alertify#min" />
<script type="text/javascript">
    $("#DataTableContent").on("click",'.delFac',function(){
        var id    = $(this).attr('data-id');
        var types = $(this).attr('data-nid');
        alertify.confirm("确定要删除此账号？", function (e) {
            if (e) {
                $.ajax({
                    type: "POST",
                    url:  '{:U("Fac/delFac")}',
                    data: {id:id,type:types},
                    dataType: "json",
                    success: function(data){
                        if(data.state==100){
                            alertify.success(data.msg);
                            location.reload(true);
                        }else{
                            alertify.error(data.msg);
                        }
                    }
                });
            } else {
                alertify.error("取消操作！");
            }
        }, "mcit_default");
    });
    $("#DataTableContents").on("click",'.delFacs',function(){
        var id    = $(this).attr('data-id');
        var types = $(this).attr('data-nid');
        alertify.confirm("确定要删除此账号？", function (e) {
            if (e) {
                $.ajax({
                    type: "POST",
                    url:  '{:U("Fac/delFac")}',
                    data: {id:id,type:types},
                    dataType: "json",
                    success: function(data){
                        if(data.state==100){
                            alertify.success(data.msg);
                            location.reload(true);
                        }else{
                            alertify.error(data.msg);
                        }
                    }
                });
            } else {
                alertify.error("取消操作！");
            }
        }, "mcit_default");
    });
</script>